extends Talent
var utils = globalData.infoDs["g_AneHekUtils"]
var base = globalData.infoDs["g_AneHekBase"]
func init():
	name = "战术回溯"
var cnt = 0.1
func _connect():
	var diff = int(base.getSetting("difficult",1))
	cnt += int(diff/5) * 0.08
	sys.main.connect("onBattleStart",self,"run")

func run():
	var chas = utils.getAllChas(2)
	for i in chas:
		i.addBuff(BF.new(cnt))

func get_info():
	return "所有角色有1次复活【恢复10%血量】机会[难度越高恢复越多]\n此天赋不需要升级"
	
class BF:
	extends Buff
	var canremove:bool = false
	var pw2
	func _init(lv):
		attInit()
		self.pw2 = lv
	func _connect():
		masCha.connect("onDeath",self,"run")

	func run(atkinfo):
		#print("天赋")
		if !masCha.isDeath:return
		if !masCha.canre:return
		masCha.isDeath = false
		atkinfo.hurtVal = 0
		var tmp = masCha.attInfo.reHp
		masCha.attInfo.reHp = 0
		masCha.upAtt()
		if sys.test:pw2 = 1
		masCha.revive(masCha.att.maxHp * pw2)
		masCha.plusHp(masCha.att.maxHp * pw2) 
		masCha.attInfo.reHp = tmp
		masCha.upAtt()
		isDel = true
			